home *** CD-ROM | disk | FTP | other *** search
/ CD Exchange / CD Exchange - Volume 1.iso / graphics / utils / videotracker / develop / source / object.s < prev    next >
Text File  |  1993-08-09  |  44KB  |  2,292 lines

  1. rout            ;when this is off, the routine-file will be
  2.             ;assembled, on=testing
  3.             
  4. ;debug            ;when this is on, colors in the background will
  5.             ;show how much time the routine needs.
  6.  
  7.  
  8. routinemode    equ    14431    ;the routinemode !
  9.  
  10.  
  11. ; the first part of the source handles the things that are necessary to
  12. ; show the picture/copper and playing of the routine.
  13. ; the part between the "***" lines is the routine-source.
  14. ; at the bottom of the file, there are the necessary incbin-files who
  15. ; are needed to test the routine.
  16. ; these are saved with "save effect" in videotracker. they are raw
  17. ; data files which can be fonts,pictures,landscapes,vectorobjects
  18. ; etcetra.
  19. ; the incbin-files are put in the "variables" table, in the routine-
  20. ; player-handler
  21. ; the place where it's done can be found by searching for "!!!"
  22.  
  23.  
  24.     opt    a+    ;devpac 3 optimize
  25.     opt    o+
  26.  
  27.     ifd    rout
  28.     
  29.     ;videotracker routine-test
  30.  
  31.     incdir    "videotracker:include/"
  32.     include    "exec/types.i"
  33.     include    "graphics/gfxbase.i"
  34.     include    "lvo/graphics_lib.i"
  35.     incdir    'videotracker:effect/'
  36.  
  37. vew_wid    equ    44
  38. vew_hgt    equ    290
  39. win_hgt    equ    117
  40. win_str    equ    $1a
  41.  
  42.     SECTION    1,CODE_C
  43. tus
  44.     lea    var,a0            ;communication-table
  45.  
  46.     move.l    #rotincobj,var_obj1(a0)    ;incbinfile !!!
  47.     move.l    #rotincbck,var_bck(a0)    ;incbinfile !!!
  48.  
  49.  
  50.     move.l    ($4).w,a6
  51.     sub.l    a1,a1
  52.     jsr    -$126(a6)        ;findtask
  53.     move.l    d0,curtsk
  54.     move.l    d0,a0
  55.     move.l    $b8(a0),tskpri
  56.  
  57.     lea    dosnam,a1        ;doslib openen
  58.     moveq.l    #0,d0
  59.     move.l    (4).w,a6
  60.     jsr    -408(a6)        ;openlib
  61.     move.l    d0,doslib
  62.  
  63.     bsr.s    label5            ;videotracker opstarten
  64.     
  65.     move.l    curtsk,a0
  66.     move.l    tskpri,$b8(a0)
  67.     move.l    ($4).w,a6
  68.     jsr    -$84(a6)        ;forbid
  69.  
  70.     move.l    doslib,a1
  71.     move.l    (4).w,a6
  72.     jsr    -414(a6)        ;closelib
  73.  
  74.     moveq.l    #0,d0
  75.     rts
  76.     
  77. label5
  78.     move.l    (4).w,a6        ;workbench gedoe
  79.     move.b    530(a6),ntscmode    ;50/60 hertz halen
  80.  
  81.     cmp.b    #50,ntscmode        ;ntsc ?
  82.     beq.s    str.ntsc
  83.     move.l    #vew_hgt-56,hogscr    ;set NTSC screen hight
  84. str.ntsc
  85.  
  86.     move.l    (4).w,a6        ;68030 cache off 
  87.     jsr    -120(a6)
  88.  
  89.     btst.b    #1,297(a6)
  90.     beq.s    str.nfc
  91.     lea.l    str.ft,a5
  92.     jsr    -30(a6)
  93. str.nfc
  94.     jsr    -126(a6)
  95.     bra.s    str.fc
  96.     
  97. str.ft
  98.     dc.w    $4e7a,2
  99.     bclr    #0,d0
  100.     bset    #13,d0
  101.     dc.w    $4e7b,2
  102.     rte
  103. str.fc
  104.  
  105.     lea    cprjmp,a2        ;copjmp zetten !
  106.     move.l    #cprbck-8,d0
  107.     move.w    d0,6(a2)
  108.     swap    d0
  109.     move.w    d0,2(a2)
  110.  
  111.     lea    cprbck-8,a2        ;copstr zetten !
  112.     move.l    #cpr,d0
  113.     move.w    d0,6(a2)
  114.     swap    d0
  115.     move.w    d0,2(a2)
  116.  
  117.     bsr    cprsprrem        ;sprites legen
  118.  
  119.     lea    gfxnam,a1        ;graphics lib openen
  120.     move.l    (4).w,a6
  121.     jsr    -408(a6)        ;openlib
  122.     move.l    d0,a6
  123.     move.l    d0,gfxlib
  124.     move.l    38(a6),oldcprlist
  125.  
  126.     bset    #1,$bfe001
  127.     bsr    copbuf            ;copper vullen
  128.  
  129.     bsr    sysoff
  130.  
  131. gadrun
  132.     btst    #6,($bfe001).l
  133.     bne    gadrun
  134.  
  135. scrend
  136. scrend.play
  137.     bsr    syson
  138.  
  139.     move.l    gfxlib,a1
  140.     move.l    (4).w,a6
  141.     jsr    -414(a6)        ;closelib
  142.  
  143. scrend.qb
  144.     moveq.l    #0,d0    
  145.     rts
  146.     
  147.     ;vertical blank interrupt, no blits.
  148.     ;handles counters,interlace,sprite
  149.     ;level 3
  150.  
  151. intvb
  152.     bra.s    intvb.cnt
  153.     dc.l    'VIDU'
  154.     dc.l    'LOOP'
  155. intvb.cnt
  156.     movem.l    d0-d7/a0-a6,-(sp)
  157.     lea    ($dff000).l,a6
  158.  
  159.     move.w    $01e(a6),d0
  160.     btst    #5,d0            ;vblank ?
  161.     bne.s    intvb.vb
  162.  
  163.     bra.s    intcop.end
  164.  
  165. intvb.vb
  166.     bsr    grap
  167.     bsr    palctr            ;palette zetten
  168.     bsr.s    copbuf            ;copper vullen
  169.     
  170. intvb.end
  171.     move.w    #$0020,$09c(a6)    ;vb bit wissen
  172.     movem.l    (sp)+,d0-d7/a0-a6    ;multitask uit, shit !
  173.     rte
  174.  
  175. intcop.end
  176.     movem.l    (sp)+,d0-d7/a0-a6
  177.     move.l    intvbold,-(sp)
  178.     rts
  179.  
  180.     ;transmission buffer empty routine, BLIT !
  181.     ;handles routines,animations
  182.     
  183. inttbe                    ;tbe interrupt
  184.     movem.l    d0-d7/a0-a6,-(sp)
  185.     lea    ($dff000).l,a6
  186.  
  187.     move.w    $01e(a6),d0
  188.     btst    #0,d0            ;no tbe ?
  189.     beq.s    intdskblk
  190.  
  191.  
  192.     btst    #6,($bfe001).l        ;muis ingedrukt ?
  193.     beq.s    inttbe.cop
  194.     btst    #2,($dff016).l
  195.     beq.s    inttbe.cop
  196.  
  197.     ifd    debug
  198.     move.w    #$700,$dff180
  199.     endc
  200.     
  201.     bsr    rotply            ;routineplayer BLIT !
  202.     bsr.s    copbuf            ;copper vullen
  203.  
  204.     ifd    debug
  205.     move.w    #$070,$dff180
  206.     endc
  207.     
  208. inttbe.cop
  209.  
  210. inttbe.end
  211.     move.w    #$0001,$09c(a6)
  212.     movem.l    (sp)+,d0-d7/a0-a6
  213.     rte
  214.  
  215. intdskblk
  216.     move.w    #$0001,$09c(a6)        ;be sure for no tbe handling
  217.     movem.l    (sp)+,d0-d7/a0-a6
  218.     move.l    inttbeold,-(sp)
  219.     rts
  220.  
  221.  
  222.     ;moves the copperbuffer to the copperlist
  223.     ;sort of double buffering
  224.     
  225. copbuf
  226.     movem.l    d0-d7/a0-a6,-(sp)
  227.  
  228.     lea    ($dff000).l,a6
  229.  
  230. copbuf.novb                ;copperchange overslaan
  231.     moveq.l    #0,d0
  232.     move.b    $005(a6),d0
  233.     lsl.w    #8,d0
  234.     moveq.l    #0,d1
  235.     move.b    $006(a6),d1
  236.     add.w    d1,d0
  237.  
  238.     cmp.w    #$4,d0
  239.     blt    copbuf.novb
  240.  
  241.     cmp.b    #50,ntscmode
  242.     beq.s    copbuf.pal
  243.     cmp.w    #$133-56-8,d0        ;ntsc grens
  244.     bge    copbuf.novb
  245.     bra.s    copbuf.cont
  246. copbuf.pal
  247.     cmp.w    #$133-8,d0        ;pal grens
  248.     bge    copbuf.novb
  249. copbuf.cont
  250.  
  251.     lea    gra.s,a0        ;buffer copieren
  252.     lea    cprbuf,a1
  253.  
  254.     move.w    00*4+2(a0),00*4+2(a1)
  255.     move.w    01*4+2(a0),01*4+2(a1)
  256.     move.w    02*4+2(a0),02*4+2(a1)
  257.     move.w    03*4+2(a0),03*4+2(a1)
  258.     move.w    04*4+2(a0),04*4+2(a1)
  259.     move.w    05*4+2(a0),05*4+2(a1)
  260.     move.w    06*4+2(a0),06*4+2(a1)
  261.     move.w    07*4+2(a0),07*4+2(a1)
  262.     move.w    08*4+2(a0),08*4+2(a1)
  263.     move.w    09*4+2(a0),09*4+2(a1)
  264.  
  265.     move.w    10*4+2(a0),10*4+2(a1)
  266.     move.w    11*4+2(a0),11*4+2(a1)
  267.     move.w    12*4+2(a0),12*4+2(a1)
  268.     move.w    13*4+2(a0),13*4+2(a1)
  269.     move.w    14*4+2(a0),14*4+2(a1)
  270.     move.w    15*4+2(a0),15*4+2(a1)
  271.     move.w    16*4+2(a0),16*4+2(a1)
  272.     move.w    17*4+2(a0),17*4+2(a1)
  273.     move.w    18*4+2(a0),18*4+2(a1)
  274.     move.w    19*4+2(a0),19*4+2(a1)
  275.  
  276.     move.w    20*4+2(a0),20*4+2(a1)
  277.     move.w    21*4+2(a0),21*4+2(a1)
  278.     move.w    22*4+2(a0),22*4+2(a1)
  279.     move.w    23*4+2(a0),23*4+2(a1)
  280.     move.w    24*4+2(a0),24*4+2(a1)
  281.     move.w    25*4+2(a0),25*4+2(a1)
  282.     move.w    26*4+2(a0),26*4+2(a1)
  283.     move.w    27*4+2(a0),27*4+2(a1)
  284.     move.w    28*4+2(a0),28*4+2(a1)
  285.     move.w    29*4+2(a0),29*4+2(a1)
  286.  
  287.     move.w    30*4+2(a0),30*4+2(a1)
  288.     move.w    31*4+2(a0),31*4+2(a1)
  289.     move.w    32*4+2(a0),32*4+2(a1)
  290.     move.w    33*4+2(a0),33*4+2(a1)
  291.     move.w    34*4+2(a0),34*4+2(a1)
  292.     move.w    35*4+2(a0),35*4+2(a1)
  293.     move.w    36*4+2(a0),36*4+2(a1)
  294.     move.w    37*4+2(a0),37*4+2(a1)
  295.     move.w    38*4+2(a0),38*4+2(a1)
  296.     move.w    39*4+2(a0),39*4+2(a1)
  297.  
  298.     move.w    40*4+2(a0),40*4+2(a1)
  299.     move.w    41*4+2(a0),41*4+2(a1)
  300.     move.w    42*4+2(a0),42*4+2(a1)
  301.     move.w    43*4+2(a0),43*4+2(a1)
  302.     move.w    44*4+2(a0),44*4+2(a1)
  303.     move.w    45*4+2(a0),45*4+2(a1)
  304.     move.w    46*4+2(a0),46*4+2(a1)
  305.     move.w    47*4+2(a0),47*4+2(a1)
  306.     move.w    48*4+2(a0),48*4+2(a1)
  307.     move.w    49*4+2(a0),49*4+2(a1)
  308.  
  309.     move.w    50*4+2(a0),50*4+2(a1)
  310.     move.w    51*4+2(a0),51*4+2(a1)
  311.     move.w    52*4+2(a0),52*4+2(a1)
  312.     move.w    53*4+2(a0),53*4+2(a1)
  313.     move.w    54*4+2(a0),54*4+2(a1)
  314.  
  315. copbuf.end
  316.     movem.l    (sp)+,d0-d7/a0-a6
  317.     rts
  318.  
  319.     ;goes back to the workbench
  320.     
  321. syson
  322.     movem.l    d0-d7/a0-a6,-(sp)
  323.  
  324.     move.w    #$0001,$dff09a        ;tbeint uit
  325.     move.l    intvbold,($6c).w
  326.     move.l    inttbeold,($64).w
  327.  
  328.     move.l    4,a6
  329.     jsr    -138(a6)        ;permit
  330.  
  331.     move.l    gfxlib,a6
  332.     jsr    -462(a6)        ;disownblitter
  333.  
  334.     move.l    wbview,a1
  335.     move.l    gfxlib,a6
  336.     jsr    _LVOLoadView(a6)     ; Fix view
  337.     jsr    _LVOWaitTOF(a6)
  338.     jsr    _LVOWaitTOF(a6)         ; wait for LoadView()
  339.  
  340. syson.ras
  341.     cmp.b    #$c0,$dff006        ;prevent copperjump
  342.     bne    syson.ras
  343.  
  344.     move.l    gfxlib,a6
  345.     move.l    gb_copinit(a6),$dff080     ; Kick it into life
  346.  
  347.     movem.l    (sp)+,d0-d7/a0-a6
  348.     rts
  349.     
  350.     ;goes back to the gadgetscreen
  351.     
  352. sysoff
  353.     movem.l    d0-d7/a0-a6,-(sp)
  354.      
  355.     move.l    gfxlib,a6
  356.     move.l    gb_ActiView(a6),wbview    ;current view
  357.     sub.l    a1,a1            ; clear a1
  358.     jsr     _LVOLoadView(a6)     ; Flush View to nothing
  359.     jsr    _LVOWaitTOF(a6)     ; Wait once
  360.     jsr    _LVOWaitTOF(a6)     ; Wait again.
  361.  
  362.     move.l    gfxlib,a6
  363.     jsr    -456(a6)        ;ownblitter
  364.  
  365.     move.l    4,a6
  366.     jsr    -132(a6)        ;forbid
  367.         
  368.     move.l    ($6c).w,intvbold
  369.     move.l    #intvb,($6c).w
  370.     move.l    ($64).w,inttbeold
  371.     move.l    #inttbe,($64).w
  372.     move.w    #$8001,$dff09a        ;tbeint aan
  373.     bsr    gracpr            ;reset copper
  374.     bsr    copbuf            ;copy copper
  375.     move.l    #cpr,$dff080
  376.  
  377.     movem.l    (sp)+,d0-d7/a0-a6
  378.     rts
  379.     
  380. cprsprrem
  381.     movem.l    d0-d7/a0-a6,-(sp)
  382.     lea    cprspr,a0
  383.     move.l    #sprdat,d0
  384.     move.w    #7,d1
  385. cprsprrem.a
  386.     move.w    d0,3*2(a0)
  387.     swap    d0
  388.     move.w    d0,1*2(a0)
  389.     swap    d0
  390.     add.l    #8,a0
  391.     dbra    d1,cprsprrem.a
  392.     movem.l    (sp)+,d0-d7/a0-a6
  393.     rts
  394.  
  395. varset                    ;variablen neerzetten
  396.     movem.l    d0-d7/a0-a6,-(sp)
  397.     move.l    #var,a0
  398.  
  399.     move.l    #cprbck,var_cprbck(a0)
  400.     move.l    gfxlib,var__GfxBase(a0)
  401.     move.b    ntscmode,var_ntsc(a0)
  402.  
  403.     move.l    curpic1,var_pic1(a0)    ;variabel
  404.     move.l    curpic2,var_pic2(a0)    ;variabel
  405.     move.w    anispd1,var_anispd1(a0)
  406.     move.w    anitel1,var_anitel1(a0)
  407.     movem.l    (sp)+,d0-d7/a0-a6
  408.     rts
  409.     
  410.     ;this routine handles all videotracker-routines
  411.  
  412. rotply    
  413.     movem.l    d0-d7/a0-a6,-(sp)
  414.  
  415.     moveq.l    #0,d0
  416.  
  417.     lea    currot1,a2        ;routine 1
  418.     move.w    rotinf1,d0        ;routine info
  419.     bsr.s    rotplyr
  420.  
  421. rotply.end
  422.     movem.l    (sp)+,d0-d7/a0-a6
  423.     rts
  424.  
  425.     ;this routine handles 1 routine, BLIT !
  426.     
  427. rotplyr
  428.     movem.l    d0-d7/a1-a6,-(sp)
  429.  
  430.     move.l    #rot,(a2)        ;routinestart address
  431.  
  432.     move.b    #50,ntscmod